Navigation

  • index
  • next |
  • previous |
  • PyHowTo documentation »
  • Basic »
  • Dictionary »

Table of Contents

Python v3.7 HowTos:

  • ----------------
  • Recursion
  • Backtracking
  • Dynamic Programming
  • Greedy
  • Sort
  • Binary Search
  • Depth First Search [DFS]
  • Breadth First Search [BFS]
  • Binary Search Tree [BST]
  • ----------------
  • Array
  • String
  • Heap
  • Stack
  • Queue
  • Tree
  • Linked List
  • Hash Table
  • Bit Manipulation
  • Two Pointers
  • Math
  • Decorator
  • ----------------
  • Basic
  • Intermediate
  • Advanced
  • Interview
  • ----------------
  • Spark
  • Tkinter
  • Turtle
  • Games
  • Web
  • ----------------
  • About
  • History

Previous topic

Map two Lists into a dictionary

Next topic

Print a dictionary in table format

Quick search

Print a dictionary line by lineΒΆ

Print a dictionary line by line.
students = {
  'Aex': {'class': 'V', 'rolld_id': 2},
  'Puja':{'class': 'V', 'roll_id': 3},
  }

for a in students:
    print(a)
    for b in students[a]:
        print (b, ':', students[a][b])

Output:

Aex
class : V
rolld_id : 2
Puja
class : V
roll_id : 3

See also

https://www.w3resource.com/python-exercises/dictionary/python-data-type-dictionary-exercise-32.php

Navigation

  • index
  • next |
  • previous |
  • PyHowTo documentation »
  • Basic »
  • Dictionary »
© Copyright 2020, Sergiy Zaytsev, szaytsev@hotmail.com. Created using Sphinx 2.3.0.